<template>
    <p>这是Home页</p>
    <p>js跳转</p>
    <button @click="pushStr"> 字符串-跳转</button>
    <button @click="pushPth"> push-path-跳转</button>
    <button @click="pushPathQuery"> push-query-跳转</button>
    <button @click="pushNaemParames"> push-命名路由-参数-跳转</button>

</template>

<script>
export default {
    methods:{
        pushStr(){
            this.$router.push("/about")
        },
        pushPth(){
            this.$router.push({path:"/about"})
        },
        pushPathQuery(){
            this.$router.push({path:"/about",query:{id:1}})
        },
        pushNaemParames(){
            this.$router.push({path:"about",state:{query:{id:1}}})
        },
        pusDynRouteByName(){
            this.$route.push({name:'product',params:{id:123}})
        },
        pusDynRouteByPathName(){
            const id=123
            this.$route.push({name:'product'+'/'+id})
        }
    },
    // mounted(){
    //     console.log('this.$route',this.$route);
    //     console.log('this.$router',this.$router);
    // }
    
}
</script>